package tbpm;

public class Main {

	public static void main(String[] args) throws Exception {

		
		System.out.println("\n\n Vamos a conectar usando la clase ActivitiRestClient");

		String idProceso = ActivitiRestClient.getProcessId("SolicitudLlamadoDocente");
		
		System.out.println("\n Id del proceso = " + idProceso);
		
		String a = ActivitiRestClient.startProcess(idProceso,"1","123","456","444","DatoOrientacion","DatoMaterias","DatoFunciones");
		
		System.out.println("\n Start = " + a);
		
		ActivitiRestClient.getTasks("assignee", "kermit");

        String b = ActivitiRestClient.getHandleTask(a);
        
        System.out.println("\n getHandle = " + b);
        
        String c = ActivitiRestClient.claimHandleTask(b);
        
        System.out.println("\n claimHandleTask = " + c);
        		
        Integer d = ActivitiRestClient.getTasks("assignee", "kermit");        
        System.out.println("\n getTasks = " + d);
        
        d = ActivitiRestClient.getTasks("candidate", "kermit");        
        System.out.println("\n getTasks = " + d);
        
        d = ActivitiRestClient.getTasks("involved", "kermit");        
        System.out.println("\n getTasks = " + d);
        
        String j = ActivitiRestClient.claimHandleTask(b);       
        System.out.println("\n ActivitiRestClient.claimHandleTask(b) = " + j);
        
        String estado = ActivitiRestClient.getEstadoTareaActual(a);
        System.out.println("\n Estado Tarea = " + estado);
        
        /*
        String f = ActivitiRestClient.completeHandleTask(b);        
        System.out.println("\n ActivitiRestClient.completeHandleTask(b) = " + f);
        */
        
        String [] instancias = ActivitiRestClient.getProcessInstances("SolicitudLlamadoDocente");
        
        System.out.print("instancias.length: " + instancias.length);
        
    	for (int i = 0; i < instancias.length; i++) {
    		System.out.print("INSTANCIA: " + instancias[i]);
        }
        
	}

}
